<template>
  <div>
    <h2>Vue Router Demo</h2>
    <button @click="back">后退</button>
    <button @click="forward">前进</button>
    <button @click="go">GO</button>
  </div>
</template>

<script>
export default {
  name: "Banner",
  methods: {
    //编程式路由导航 router的两个API
    back() {  //后退
      this.$router.back()
    },
    forward() {  //前进
      this.$router.forward()
    },
    go() { //可前进也可后退，传递的数字决定前退几步 负数为后退 正数为前进
      this.$router.go(1)
    }
  }
}
</script>

<style scoped>

</style>